#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3f;
const int Mod = 998244353;
int qpow(int a, int b)
{
    int ret = 1;
    while (b > 0)
    {
        if (b & 1)
            ret = ret * a % Mod;
        a = a * a % Mod;
        b >>= 1;
    }
    return ret;
}

void solve()
{
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].first;
        sum += a[i].first;
    }
    for (int i = 0; i < n; i++) cin >> a[i].second;
    sort(a.begin(), a.end(), greater<pair<int, int>>());
    int i = 0;
    int ans = 0;
    while (sum < t && i < n)
    {
        if (a[i].first == 0) continue;
        int x = min(a[i].second, (int)ceil((t - sum) / (double)a[i].first));
        sum += a[i].first * x;
        ans += x;
        i++;
    }
    if (i == n && sum < t) cout << -1 << endl;
    else cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    // cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}